SET PROC TO SOSPRO
F1='PATIENT'
F2='PATIENTA'
SET exclu on
SELE 2
USE &DR1&F2
SELE 1
USE &DR1&F1
go top
do while .not. eof()
   SELE 2
   IF FIL_LOCK()
      APPEN BLANK
   ENDIF
   IF REC_LOCK()
      REPL HOUR_APP WITH A->HOUR_APP,DR_APP WITH A->DR_APP,DAT_APP WITH A->DAT_APP
      REPL APP_DATE WITH A->APP_DATE,DR_CODE WITH A->DR_CODE,REL_FILE WITH A->REL_FILE
      REPL REL_FILCOD WITH A->REL_FILCOD,ENTRY_DAT WITH A->ENTRY_DAT,PAT_FILCOD WITH A->PAT_FILCOD
      REPL PAT_CODDAT WITH A->PAT_CODDAT,PAT_CODCRE WITH A->PAT_CODCRE,PAT_CODCRP WITH A->PAT_CODCRP
      REPL PAT_CODTYP WITH A->PAT_CODTYP,DAT_CRFILE WITH A->DAT_CRFILE,FAM_PERCOD WITH A->FAM_PERCOD
      REPL FAM_RELPER WITH A->FAM_RELPER,AEASOS_FAM WITH A->AEASOS_FAM,AEASOS_PER WITH A->AEASOS_PER
      REPL AEA_ENDATE WITH A->AEA_ENDATE,AEA_PROGR WITH A->AEA_PROGR,AEA_MEMBER WITH A->AEA_MEMBER
      REPL HL_FEE WITH A->HL_FEE,HL_DENT WITH A->HL_DENT,HL_END WITH A->HL_END
      REPL HL_START WITH A->HL_START,HL_PERIOD WITh A->HL_PERIOD,HEALTHLINE WITH A->HEALTHLINE
      REPL JOB_FINMGR WITH A->JOB_FINMGR,JOB_PERMGR WITH A->JOB_PERMGR,JOB_TELEX WITH A->JOB_TELEX
      REPL JOB_TEL3 WITH A->JOB_TEL3,JOB_TEL2 WITH A->JOB_TEL2,JOB_TEL1 WITH A->JOB_TEL1
      REPL JOB_FAX WITH A->JOB_FAX,JOB_COUNT WITH A->JOB_COUNT,JOB_CITY WITH A->JOB_CITY
      REPL JOB_ADD2 WITH A->JOB_ADD2,JOB_ADD1 WITH A->JOB_ADD1,JOB_CRPCOD WITH A->JOB_CRPCOD
      REPL JOB_CORP WITH A->JOB_CORP,JOB_POSIT WITH A->JOB_POSIT,LOC_TEL WITH A->LOC_TEL
      REPL LOC_CITY WITH A->LOC_CITY,LOC_ADD2 WITH A->LOC_ADD2,LOC_ADD1 WITH A->LOC_ADD1
      REPL RESID_INDO WITH A->RESID_INDO,HOM_TEL WITH A->HOM_TEL,HOM_COUNT WITH A->HOM_COUNT
      REPL HOM_CITY WITH A->HOM_CITY,HOM_ADD WITH A->HOM_ADD,BLOOD_RHE WITH A->BLOOD_RHE
      REPL BLOOD_GRP WITH A->BLOOD_GRP,PAT_SEX WITH a->PAT_SEX,PAT_NATIO WITH A->PAT_NATIO
      REPL PAT_DOB WITH A->PAT_DOB,PAT_M_INIT WITH A->PAT_M_INIT,PAT_F_NAME WITH A->PAT_F_NAME
      REPL PAT_NAME WITH A->PAT_NAME
   ENDIF
   UNLOCK
   SELE 1
   skip
enddo
SET exclu on
CLOS DATA
DR='N:'
F1='PATIENT.DBF'
F2='PATIENTB.DBF'
F3='PATIENTA.DBF'
IF FILE("&DR1&F1")
   use &DR1&f1
   if fil_lock(0)
      copy to &DR1&f2
   endif
   unlock
ENDIF
IF FILE("&DR1&F3")
   use &DR1&f3
   if fil_lock(0)
      copy to &DR1&f1
   endif
   unlock
ENDIF
retu



